<?php

class Core{
	
	protected
	$controller,
	$model,
	$view,
	$method,
	$params,
	$init = 'init/init';
	
	function __construct(){
		
		$url = $this->getURL();
		$this->debugURL($url);
		$this->run();
	}
	
	private function getURL(){
		
		$url = (!isset($_GET['url']))? explode('/', $this->init) : explode('/', $_GET['url']);
		return $url;
				
	}
	
	public function debugURL($url){
		
		$this->controller = (file_exists(_controller_.'con'.$url[0].'.php')) ? 'con'.$url[0] : 'coninit' ;
		$this->method = (!isset($url[1]) || $url[1] == '') ? 'init' : $url[1] ;
		
		$j = count($url);
		
		for($i = 2; $i < $j; $i++){
			
			if($url[$i] != ''){
				
				$this->params[] = $url[$i];
			
			}
		
		}
		
	}
	
	private function run(){
		
		require_once _controller_.$this->controller.".php";
		$obj = new $this->controller($this->method, $this->params);

	}
		
}